package org.card.util;

import org.card.bean.User;
import org.springframework.stereotype.Component;

/**
 * Created by card on 16/3/4.
 */
@Component
public class UserHolder {

    private ThreadLocal<User> threadLocal = new ThreadLocal<User>();

    public void setUser(User user) {
        threadLocal.set(user);
    }

    public User getUser() {
        return threadLocal.get();
    }

    public void remove() {
        threadLocal.remove();
    }
}
